package com.mercury.tests;
import org.hibernate.*;
import org.hibernate.criterion.Restrictions;

import com.mercury.beans.*;
public class Test2b {
	public static void main(String[] args){
		SessionFactory factory = HibernateUtil.getSessionFactory(); //hibernate 3
		Session session = factory.getCurrentSession();
		//Session session = HibernateUtil.currentSession();
		Transaction tx = session.beginTransaction();  //
		//Criteria
		Criteria ct = session.createCriteria(User.class);
		User user = (User)ct.add(Restrictions.eq("name","Carson")).uniqueResult();
		System.out.println(user);
		tx.commit();
	}
}
